package com.zipking.cloud.springbootmybatis.zh;

public abstract class OrganizationComponent {

    private String name;

    private String description;

    public OrganizationComponent(String name, String description) {
        this.name = name;
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    // 叶子节点不需要实现，故不定义成抽象方法，而是采用默认实现
    protected void add(OrganizationComponent organizationComponent) {
        // 默认实现
        throw new UnsupportedOperationException();
    }

    protected void remove(OrganizationComponent organizationComponent) {
        // 默认实现
        throw new UnsupportedOperationException();
    }

    // 抽象方法print()，子类都需要实现
    protected abstract void print();
}
